/**
 * 
 */
package de.fsujena.chat_pi.message;

/**
 * Representation of a system message. It is supposed to be used for system procedures
 * like setting up a connection, login or registration.
 * 
 * @author Erik Hebestreit
 * @see Message
 */
public class SysMessage extends Message {
	/**
	 * 
	 */
	private static final long serialVersionUID = -51527432554652097L;
	
	public enum CATEGORY {
		ERROR, 
		CONNECTION,
		LOGIN,
		REGISTRATION,
		CHANGE_PASSWORD, 
		CHANGE_USERNAME,
		STATUS, 
		ADMIN,
		MODERATE,
	}
	
	public enum MESSAGE {
		// errors
		MSG_NOT_EXPECTED,
		WRONG_MSG_TYPE,
		
		// connection related
		CONNECTED, DISCONNECTED, START_CONNECT,								//START_CONNECT unused?				
		SERVER_CLOSED,
		
		// login related
		LOGGED_IN, NOT_LOGGED_IN, ALREADY_LOGGED_IN,
		WANT_TO_LOGIN,LOGGED_OUT, USER_ALREADY_LOGGED_IN,
		REQUEST_USERNAME, SEND_USERNAME, USERNAME_UNKNOWN,USERNAME_BANNED,
		REQUEST_PASSWORD, SEND_PASSWORD, PASSWORD_RIGHT, PASSWORD_WRONG,		
		
		// registration related
		WANT_TO_REGISTER,
		REQUEST_NEW_USERNAME, SEND_NEW_USERNAME, USERNAME_ALREADY_EXISTS,
		REQUEST_NEW_PASSWORD, SEND_NEW_PASSWORD, 
		REGISTRATION_SUCCESSFUL,
		REMOVE_ME,
		TYPE_PASSWORD,
		
		// change password
		WANT_TO_CHANGE_PASSWORD, LOGIN_FIRST, 
		REQUEST_OLD_PASSWORD, SEND_OLD_PASSWORD, OLD_PASSWORD_WRONG,		//xxx_old_password unused?
		REQUEST_CHANGED_PASSWORD, SEND_CHANGED_PASSWORD,
		PASSWORD_CHANGED,
		
		// change username
		WANT_TO_CHANGE_USERNAME,
		REQUEST_CHANGED_USERNAME,SEND_CHANGED_USERNAME,
		USERNAME_CHANGED,
		
		
		// status messages
		REQUEST_USER_LIST, SEND_USER_LIST, 
		REQUEST_ROOM_LIST, SEND_ROOM_LIST, 
		NEW_USER_INFO, USER_LEFT_INFO,
		USER_KICKED,//USER_BANNED,USER_UNBANNED,
		NO_ADMIN,NO_MOD,
		BECOME_ADMIN,BECOME_MOD,
		REQUEST_ADMIN_LIST,SEND_ADMIN_LIST,
		REQUEST_MOD_LIST,SEND_MOD_LIST,
		YOU_ARE_REMOVED,
		REQUEST_ROLE,SEND_ROLE,
		
		//admin message
		REMOVE_USER,
		
		//moderator 
		BANN_USER,UNBANN_USER,
		KICK_USER,
		
	}
	
	// Content of system message
	private CATEGORY category;
	private MESSAGE message;
	private String messageString;
	private Object messageObject;
	

	/**
	 * Constructor.
	 */
	public SysMessage() {}
	
	/**
	 * Constructor.
	 * 
	 * @param cat category of the message
	 * @param msg type of the message
	 */
	public SysMessage(CATEGORY cat, MESSAGE msg) {
		this.category = cat;
		this.message = msg;
	}
	
	/**
	 * Constructor.
	 * 
	 * @param cat category of the message
	 * @param msg type of the message
	 * @param msgStr additional string which is used to send informations with a system
	 * message
	 */
	public SysMessage(CATEGORY cat, MESSAGE msg, String msgStr) {
		this.category = cat;
		this.message = msg;
		this.messageString = msgStr;
	}
	
	/**
	 * @return category of the message
	 */
	public CATEGORY getCategory() {
		return this.category;
	}
	
	/**
	 * @param cat category of the message
	 */
	public void setCategory(CATEGORY cat) {
		this.category = cat;
	}
	
	/**
	 * @return type of the message
	 */
	public MESSAGE getMessage() {
		return this.message;
	}
	
	/**
	 * @param message type of the message
	 */
	public void setMessage(MESSAGE message) {
		this.message = message;
	}

	/**
	 * @return additional string which is used to send informations with a system
	 * message
	 */
	public String getMessageString() {
		return messageString;
	}

	/**
	 * @param messageString additional string which is used to send informations with a
	 * system message
	 */
	public void setMessageString(String messageString) {
		this.messageString = messageString;
	}


	/**
	 * @return the message object
	 */
	public Object getMessageObject() {
		return messageObject;
	}


	/**
	 * @param messageObject the message object to set
	 */
	public void setMessageObject(Object messageObject) {
		this.messageObject = messageObject;
	}

}
